<%@ page import="cn.school.entity.Student" %>
<%@ page import="cn.school.util.StringUtil" %>
<%@ page import="cn.school.entity.Grade" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>Title</title>
    <style>

        form {
            text-align: center;
            background-color: rebeccapurple;
        }

        form p label {
            display: inline-block;
            width: 80px;
            height: 36px;
            line-height: 36px;
            text-align: left;
        }
    </style>
   <%-- <%
        //Student s = (Student) request.getAttribute("student");

        //String enterdate,birthday;
        //enterdate = StringUtil.format(s.getEnterdate());
        //birthday=StringUtil.format(s.getBirthday());
    %>--%>

    <script src="js/jquery-3.4.1.min.js"></script>
    <script>
        $(function(){
            $(":radio.input[value=${student.sex}]").prop("checked",true);
        });
    </script>
</head>
<body>
<%@ include file="/WEB-INF/checkLogin.jsp"%>
<form method="post" action="updateStudentServlet">
    <p>学生信息</p>
    <%--<%--%>
    <%--Student s = (Student) request.getAttribute("student");--%>
    <%--%>--%>
    <p><label>学号:</label>
        <input type="text" name="stuno" value="${student.stuno}">
        </p>
    <p><label>姓名:</label>
        <input type="text" name="sname" value="${student.sname}"></p>
    <p><label>性别:</label>
        <input type="radio" name="sex" value="男" class="input">男
        <input type="radio" name="sex" value="女" class="input">女
        <input type="radio" name="sex" value="妖" class="input">妖
        <input type="radio" name="sex" value="人妖" class="input">人妖
    </p>
    <p><label>手机号:</label>
        <input type="number" name="tet" minlength="11" maxlength="11" value="${student.telephone}">
    </p>
    <p><label>QQ:</label>
        <input type="number" name="qq" min="0" value="${student.qq}"></p>
    <p><label>微信号:</label>
        <input type="text" name="wechat" value="${student.wechat}"></p>
    <p><label>年级:</label>
        <select name="gradeid" style="width: 165px;height: 18px;">
            <c:forEach items="${grades}" var="g">
                <option value="${g.id}" <c:if test="${student.gradeid==g.id}"> selected</c:if>>
                    ${g.gname}
                </option>
            </c:forEach>

        </select>
    <p><label>入学日期:</label>
        <input type="date" name="enter" style="width: 165px;height: 20px;"
               value="<fmt:formatDate value='${student.enterdate}' pattern='yyyy-MM-dd' />"></p>
    <p><label>来自:</label>
        <input type="text" name="from" value="${student.fromcity}"></p>
    <p><label>出生日期:</label>
        <input type="date" name="birthday" style="width: 165px;height: 20px;"
               value="<fmt:formatDate value='${student.birthday}' pattern='yyyy-MM-dd' />"></p>
    <p><label>地址:</label>
        <input type="text" name="address" value="${student.address}"></p>
    <p><label>密码:</label>
        <input type="text" name="pass" value="${student.pass}"></p>
    <p><input type="submit" value="修改"></p>
</form>

</body>
</html>
